package com.bonc.ioc.demo.condition;

import com.bonc.ioc.demo.constant.ActiveProfilesConstant;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @projectName: demo
 * @description: 加密传输过滤器
 * @author: Liyy
 * @create: 2020-08-30 16:12
 **/
public class DecryptCondition implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        if (conditionContext.getEnvironment().getActiveProfiles()[0].equals(ActiveProfilesConstant.PROD)
                || conditionContext.getEnvironment().getActiveProfiles()[0].equals(ActiveProfilesConstant.TEST)) {
            return true;
        } else {
            return false;
        }
    }
}
